package com.bawei.system.remote.factory;

import com.bawei.system.domain.vo.IndexInfo;
import com.bawei.system.remote.api.RemoteEsIndexService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.bawei.common.core.domain.R;

import java.util.List;
import java.util.Map;

/**
 * 用户服务降级处理
 *
 * @author bawei
 */
@Component
public class RemoteEsIndexFallbackFactory implements FallbackFactory<RemoteEsIndexService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteEsIndexFallbackFactory.class);

    @Override
    public RemoteEsIndexService create(Throwable throwable)
    {
        log.error("全文检索服务调用失败:{}", throwable.getMessage());
        return new RemoteEsIndexService() {
            @Override
            public R<Boolean> indexCreate(String indexName) {
                return null;
            }

            @Override
            public R<Boolean> createEsStyle(IndexInfo indexInfo) {
                return null;
            }

            @Override
            public R<Boolean> indexCreateWithMapping(String indexName, String indexMapping) {
                return null;
            }

            @Override
            public R<Boolean> indexExit(String indexName) {
                return null;
            }

            @Override
            public R<Boolean> indexDelete(String indexName) {
                return null;
            }

            @Override
            public R<Map> indexGetMapping(String indexName) {
                return null;
            }
        };

    }
}


